package io.jpress.module.article.service;

import com.jfinal.plugin.activerecord.Page;
import io.jpress.module.article.model.ArticleVersion;

import java.util.List;

public interface ArticleVersionService  {

    /**
     * find model by primary key
     *
     * @param id
     * @return
     */
    public ArticleVersion findById(Object id);


    /**
     * find all model
     *
     * @return all <ArticleVersion
     */
    public List<ArticleVersion> findAll();


    /**
     * delete model by primary key
     *
     * @param id
     * @return success
     */
    public boolean deleteById(Object id);


    /**
     * delete model
     *
     * @param model
     * @return
     */
    public boolean delete(ArticleVersion model);


    /**
     * save model to database
     *
     * @param model
     * @return  id value if save success
     */
    public Object save(ArticleVersion model);


    /**
     * save or update model
     *
     * @param model
     * @return id value if saveOrUpdate success
     */
    public Object saveOrUpdate(ArticleVersion model);


    /**
     * update data model
     *
     * @param model
     * @return
     */
    public boolean update(ArticleVersion model);


    /**
     * paginate query
     *
     * @param page
     * @param pageSize
     * @return
     */
    public Page<ArticleVersion> paginate(int page, int pageSize);

//fuye修改:增加通过pid选取所有版本的接口
    /**
    *find all version by pid(文章id)
     * @param pid 文章id
     */
    public List<ArticleVersion> findAllByPid(int pid);

    public boolean checkContent(Integer pid,String content);

    public boolean checkNewByPid(long pid) throws Exception;

    public Long getTheLastVersionByPid(Long pid);

// fuye修改结束

}